<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Language" content="zh-CN"><link href="stylesheet.css" media="all" rel="stylesheet" type="text/css">
<title>COMMIT PREPARED</title>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head><body class="REFENTRY">
<div>
<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><th colspan="5" align="center" valign="bottom">PostgreSQL 8.2.3 中文文档</th></tr>
<tr><td width="10%" align="left" valign="top"><a href="sql-commit.html" accesskey="P">后退</a></td><td width="10%" align="left" valign="top"><a href="sql-commit.html">快退</a></td><td width="60%" align="center" valign="bottom"></td><td width="10%" align="right" valign="top"><a href="sql-copy.html">快进</a></td><td width="10%" align="right" valign="top"><a href="sql-copy.html" accesskey="N">前进</a></td></tr>
</table>
<hr align="LEFT" width="100%"></div>
<h1><a name="SQL-COMMIT-PREPARED"></a>COMMIT PREPARED</h1>
<div class="REFNAMEDIV"><a name="AEN46012"></a><h2>名称</h2>COMMIT PREPARED&nbsp;--&nbsp;提交一个早先为两阶段提交准备好的事务</div>
<a name="AEN46015"></a>
<div class="REFSYNOPSISDIV"><a name="AEN46017"></a><h2>语法</h2>
<pre class="SYNOPSIS">COMMIT PREPARED <tt class="REPLACEABLE"><i>transaction_id</i></tt></pre>
</div>
<div class="REFSECT1"><a name="AEN46020"></a><h2>描述</h2>
<p><tt class="COMMAND">COMMIT PREPARED</tt> 提交一个早先为两阶段提交准备好的事务。</p>
</div>
<div class="REFSECT1"><a name="AEN46024"></a><h2>参数</h2>
<div class="VARIABLELIST">
<dl>
<dt><tt class="REPLACEABLE"><i>transaction_id</i></tt></dt>
<dd><p>要提交的事务的标识符</p></dd>
</dl>
</div>
</div>
<div class="REFSECT1"><a name="AEN46032"></a><h2>注意</h2>
<p>要提交一个预备事务，你必须是最初执行该事务的用户或超级用户。不过你不必在同一个会话里执行该命令。</p>
<p>这条命令不能在事务块里执行。预备事务立即提交。</p>
<p>所有目前可用的预备事务都在系统视图 <a href="view-pg-prepared-xacts.html"><tt class="STRUCTNAME">pg_prepared_xacts</tt></a> 里列出。</p>
</div>
<div class="REFSECT1"><a name="SQL-COMMIT-PREPARED-EXAMPLES"></a><h2>例子</h2>
<p>提交事务标识符 <tt class="LITERAL">foobar</tt> 标识的事务：</p>
<pre class="PROGRAMLISTING">COMMIT PREPARED 'foobar';</pre>
</div>
<div class="REFSECT1"><a name="AEN46044"></a><h2>又见</h2><a href="sql-prepare-transaction.html"><i>PREPARE TRANSACTION</i></a>, <a href="sql-rollback-prepared.html"><i>ROLLBACK PREPARED</i></a></div>
<div>
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="33%" align="left" valign="top"><a href="sql-commit.html" accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">首页</a></td><td width="33%" align="right" valign="top"><a href="sql-copy.html" accesskey="N">前进</a></td></tr>
<tr><td width="33%" align="left" valign="top">COMMIT</td><td width="34%" align="center" valign="top"><a href="sql-commands.html" accesskey="U">上一级</a></td><td width="33%" align="right" valign="top">COPY</td></tr>
</table>
</div>
</body></html>